package inits

import (
	"ZK306/common/config"
	"fmt"
	"github.com/go-redis/redis/v8"
)

var Rdb *redis.Client

func InitRedis() {
	red := config.NaCos.Redis
	Rdb = redis.NewClient(&redis.Options{
		Addr:     red.Addr,
		Password: red.Password,
		DB:       red.Db,
	})
	ping, err := Rdb.Ping(Rdb.Context()).Result()
	if err != nil {
		return
	}
	fmt.Println("redis连接成功", ping)
}
